<!DOCTYPE html>
<html lang="en">

<!-- Mirrored from uxliner.com/adminkit/demo/main/ltr/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 14 May 2021 17:30:44 GMT -->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>${title} - 机票预订系统</title>
<#include "../header.ftl">
<!-- Left side column. contains the logo and sidebar -->
<#include "../nav.ftl">
  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"> 
    <!-- Content Header (Page header) -->
    <div class="content-header sty-one">
      <h1>${title}</h1>
      <ol class="breadcrumb">
        <li><a href="/admin/index.html">主页</a></li>
        <li><i class="fa fa-angle-right"></i> ${title}</li>
      </ol>
    </div>
    
    <!-- Main content -->
    <div class="content">
      <div class="card">
      <div class="card-body">
      <div class="table-responsive">
      <div class="pull-left search-box">
        <form action="/admin/buyticket.html" id="submitForm" name="submitForm" method="get" class="search-form">
          <div class="input-group" style="padding-bottom:10px;">
              <span style="padding-top:10px;">航班号：</span><input name="keyword" class="form-control" placeholder="" type="text" <#if keyword??>value="${keyword}"</#if>>
           <span style="padding-top:10px; padding-left:25px;">出发地：</span><select class="custom-select form-control" id="departurePlace" name="departurePlace">
              	<option value="">请选择</option>
              	<option value="广州">广州</option>
              	<option value="深圳">深圳</option>
              	<option value="北京">北京</option>
              	<option value="上海">上海</option>
              	<option value="天津">天津</option>
              	<option value="成都">成都</option>
              	<option value="武汉">武汉</option>
              	<option value="重庆">重庆</option>
              	<option value="南宁">南宁</option>
              	<option value="拉萨">拉萨</option>
              	<option value="贵阳">贵阳</option>
              	<option value="石家庄">石家庄</option>
              </select>
            <span style="padding-top:10px; padding-left:25px;">到达地：</span><select class="custom-select form-control" id="arrivalPlace" name="arrivalPlace">
              	<option value="">请选择</option>
              	<option value="广州">广州</option>
              	<option value="深圳">深圳</option>
              	<option value="北京">北京</option>
              	<option value="上海">上海</option>
              	<option value="天津">天津</option>
              	<option value="成都">成都</option>
              	<option value="武汉">武汉</option>
              	<option value="重庆">重庆</option>
              	<option value="南宁">南宁</option>
              	<option value="拉萨">拉萨</option>
              	<option value="贵阳">贵阳</option>
              	<option value="石家庄">石家庄</option>
              </select>  
           <span style="padding-top:10px; padding-left:25px;">出发时间：</span><input class="form-control" id="departureDate" name="departureDate" type="date" />
            <span class="input-group-btn">
            <button type="button" name="search" id="search-btn" class="btn btn-flat" onclick="checkSubmit();"><i class="fa fa-search"></i> </button>
            </span></div>
        </form>
        </div>
          <table class="table table-hover">
            <thead>
              <tr>
                <th scope="col">#</th>
                <th scope="col">航班号</th>
                <th scope="col">航班公司</th>
                <th scope="col">机型</th>
                <th scope="col">出发地</th>
                <th scope="col">到达地</th>
                <th scope="col">出发机场</th>
                <th scope="col">到达机场</th>
                <th scope="col">出发时间</th>
                <th scope="col">到达时间</th>
                <th scope="col">票价</th>
                <th scope="col">--</th>
              </tr>
            </thead>
            <tbody>
              <#if retCode??>
              	<tr>
                <td colspan="15" style="text-align:center;">暂无结果展示</td>
              	</tr>
              <#else>
              	<#if resultList??>
					<#list resultList as rs>
						<tr>
			                <#--<th scope="row">${rs['id']}</th>-->
			                <td>${rs['flightNumber']}</td>
			                <td>${rs['flightCompany']}</td>
			                <td>${rs['flightModel']}</td>
			                <td>${rs['departurePlace']}</td>
			                <td>${rs['arrivalPlace']}</td>
			                <td>${rs['departureAirport']}</td>
			                <td>${rs['arrivalAirport']}</td>
			                <td>${rs['departureTime']}</td>
			                <td>${rs['arrivalTime']}</td>
			                <td>${rs['price']?string.currency}</td>
			                <td><a href="/admin/do_buy_ticket.html?id=${rs['id']}">购买</a></td>
		              	</tr>
					</#list>
				</#if>
              </#if>
            </tbody>
          </table>
        </div>
    </div>
    </div>
    </div>
    <!-- /.content --> 
  </div>
  <script>
    var thisPageUrl = window.location.href;
    if(thisPageUrl.indexOf("?")>0){
    	thisPageUrl = thisPageUrl.substring(0,thisPageUrl.indexOf("?"));
    }
  	function checkSubmit(){
  		let departureDateStr = $("#departureDate").val();
  		let nowTime = new Date();
  		if(departureDateStr!=null && departureDateStr!=""){
  			departureDateStr = departureDateStr + " 23:59:59";
  			let departureDate = new Date(departureDateStr);
  			if(nowTime >= departureDate){
	  			alertMsg("出发时间必须大于等于当前时间");
	  			return;
  			}
  		}
  		$("#submitForm").submit();
  	}
  	
  	initData();
  	function initData(){
  		<#if departurePlace??>
  			let departurePlace = "${departurePlace}";
  			$("#departurePlace").val(departurePlace);
  		</#if>
  		<#if arrivalPlace??>
  			let arrivalPlace = "${arrivalPlace}";
  			$("#arrivalPlace").val(arrivalPlace);
  		</#if>
  		<#if departureDate??>
  			let departureDate = "${departureDate}";
  			$("#departureDate").val(departureDate);
  		</#if>
  	}
  </script>
<#include "../footer.ftl">
</html>